package zuoye29.zuoye4;

public class bijiao {
    public static void main(String[] args) {
        StringBuilder sb = new StringBuilder();
        StringBuffer sbf = new StringBuffer();

        long startTime = System.currentTimeMillis();

        for (int i = 0; i < 100000; i++) {
            sb.append("A");
        }

        long endTime = System.currentTimeMillis();
        System.out.println("StringBuilder time: " + (endTime - startTime) + " ms");

        startTime = System.currentTimeMillis();

        for (int i = 0; i < 100000; i++) {
            sbf.append("A");
        }

        endTime = System.currentTimeMillis();
        System.out.println("StringBuffer time: " + (endTime - startTime) + " ms");
    }
}
